package com.aspose.cells;

class zamz {
   static double a(double var0, double var2, double var4, double[] var6) {
      double var7 = 0.0D;
      double var9 = 1.0D;

      for(int var11 = 0; var11 < var6.length; ++var11) {
         var9 = Math.pow(var0, var2 + (double)var11 * var4);
         var7 += var6[var11] * var9;
      }

      return var7;
   }

   static double a(double[] var0, double[] var1) {
      double var2 = 0.0D;

      for(int var4 = 0; var4 < var0.length; ++var4) {
         var2 += var0[var4] * var0[var4] - var1[var4] * var1[var4];
      }

      return var2;
   }

   static double b(double[] var0, double[] var1) {
      double var2 = 0.0D;

      for(int var4 = 0; var4 < var0.length; ++var4) {
         var2 += var0[var4] * var0[var4] + var1[var4] * var1[var4];
      }

      return var2;
   }

   static double c(double[] var0, double[] var1) {
      double var2 = 0.0D;

      for(int var4 = 0; var4 < var0.length; ++var4) {
         var2 += (var0[var4] - var1[var4]) * (var0[var4] - var1[var4]);
      }

      return var2;
   }

   static double a(double[] var0) {
      double var1 = 0.0D;

      for(int var3 = 0; var3 < var0.length; ++var3) {
         var1 += var0[var3] * var0[var3];
      }

      return var1;
   }

   static Object a(int var0, int var1) {
      char[] var2 = new char[]{'M', 'D', 'C', 'L', 'X', 'V', 'I'};
      short var3 = 1000;
      char[] var4 = new char[256];
      int var7 = var3;
      if (var0 >= 0 && var0 <= 3999) {
         if (var1 >= 0 && var1 <= 4) {
            if (var0 == 0) {
               return "";
            } else {
               int var6 = 0;

               int var5;
               for(var5 = 0; var7 > 1; var6 += 2) {
                  for(; var0 > 0; ++var5) {
                     if (var0 >= var7) {
                        var4[var5] = var2[var6];
                        var0 -= var7;
                     } else if (var0 >= var7 - var7 / 10) {
                        var4[var5++] = var2[var6 + 2];
                        var4[var5] = var2[var6];
                        var0 -= var7 - var7 / 10;
                     } else if (var0 >= var7 / 2) {
                        var4[var5] = var2[var6 + 1];
                        var0 -= var7 / 2;
                     } else if (var0 >= var7 / 2 - var7 / 10) {
                        var4[var5++] = var2[var6 + 2];
                        var4[var5] = var2[var6 + 1];
                        var0 -= var7 / 2 - var7 / 10;
                     } else {
                        if (var7 != 10) {
                           break;
                        }

                        var4[var5] = var2[var6 + 2];
                        --var0;
                     }
                  }

                  var7 /= 10;
               }

               StringBuilder var8 = new StringBuilder();
               var8.append(var4, 0, var5 + 1);
               if (var1 > 0) {
                  com.aspose.cells.b.a.g.zf.a(var8, "XLV", "VL");
                  com.aspose.cells.b.a.g.zf.a(var8, "XCV", "VC");
                  com.aspose.cells.b.a.g.zf.a(var8, "CDL", "LD");
                  com.aspose.cells.b.a.g.zf.a(var8, "CML", "LM");
                  com.aspose.cells.b.a.g.zf.a(var8, "CMVC", "LMVL");
               }

               if (var1 == 1) {
                  com.aspose.cells.b.a.g.zf.a(var8, "CDXC", "LDXL");
                  com.aspose.cells.b.a.g.zf.a(var8, "CDVC", "LDVL");
                  com.aspose.cells.b.a.g.zf.a(var8, "CMXC", "LMXL");
                  com.aspose.cells.b.a.g.zf.a(var8, "XCIX", "VCIV");
                  com.aspose.cells.b.a.g.zf.a(var8, "XLIX", "VLIV");
               }

               if (var1 > 1) {
                  com.aspose.cells.b.a.g.zf.a(var8, "XLIX", "IL");
                  com.aspose.cells.b.a.g.zf.a(var8, "XCIX", "IC");
                  com.aspose.cells.b.a.g.zf.a(var8, "CDXC", "XD");
                  com.aspose.cells.b.a.g.zf.a(var8, "CDVC", "XDV");
                  com.aspose.cells.b.a.g.zf.a(var8, "CDIC", "XDIX");
                  com.aspose.cells.b.a.g.zf.a(var8, "LMVL", "XMV");
                  com.aspose.cells.b.a.g.zf.a(var8, "CMIC", "XMIX");
                  com.aspose.cells.b.a.g.zf.a(var8, "CMXC", "XM");
               }

               if (var1 > 2) {
                  com.aspose.cells.b.a.g.zf.a(var8, "XDV", "VD");
                  com.aspose.cells.b.a.g.zf.a(var8, "XDIX", "VDIV");
                  com.aspose.cells.b.a.g.zf.a(var8, "XMV", "VM");
                  com.aspose.cells.b.a.g.zf.a(var8, "XMIX", "VMIV");
               }

               if (var1 == 4) {
                  com.aspose.cells.b.a.g.zf.a(var8, "VDIV", "ID");
                  com.aspose.cells.b.a.g.zf.a(var8, "VMIV", "IM");
               }

               return com.aspose.cells.b.a.zr.a(var8);
            }
         } else {
            return zst.i;
         }
      } else {
         return zst.i;
      }
   }

   static double a(int[] var0) {
      int var1 = 0;
      double var2 = 1.0D;

      for(int var4 = 0; var4 < var0.length; ++var4) {
         var1 += var0[var4];
         var2 *= b(var0[var4]);
      }

      return b(var1) / var2;
   }

   static double a(double var0) {
      if (Math.abs(var0 % 2.0D) < 1.0E-14D) {
         return var0;
      } else {
         double var2 = var0 >= 0.0D ? 1.0D : -1.0D;
         var0 = Math.abs(var0);
         ++var0;
         var0 = Math.floor(var0);
         return var0 % 2.0D < 1.0E-14D ? var2 * var0 : var2 * (var0 + 1.0D);
      }
   }

   static double b(double var0) {
      var0 = Math.ceil(var0);
      double var2 = var0 >= 0.0D ? 1.0D : -1.0D;
      var0 = Math.abs(var0);
      return var0 % 2.0D <= 1.0E-14D ? var2 * (var0 + 1.0D) : var2 * var0;
   }

   static double b(int var0, int var1) {
      return (double)(var0 * var1) / c(var0, var1);
   }

   static double b(double[] var0) {
      int var1 = (int)c(var0);
      double var2 = var0[0];

      for(int var4 = 1; var4 < var0.length; ++var4) {
         var2 = var2 * var0[var4] / (double)var1;
      }

      return var2;
   }

   static double c(double[] var0) {
      int var1 = (int)var0[0];

      for(int var2 = 1; var2 < var0.length; ++var2) {
         var1 = (int)c(var1, (int)var0[var2]);
      }

      return (double)var1;
   }

   static double c(int var0, int var1) {
      if (var0 == 0) {
         return (double)var1;
      } else if (var1 == 0) {
         return (double)var0;
      } else {
         int var2;
         if (var0 < var1) {
            var2 = var0;
            var0 = var1;
            var1 = var2;
         }

         while(var1 != 0) {
            var2 = var0 % var1;
            var0 = var1;
            var1 = var2;
         }

         return (double)var0;
      }
   }

   static double a(int var0) {
      double var1 = 1.0D;

      for(int var3 = var0; var3 > 1; var3 -= 2) {
         var1 *= (double)var3;
      }

      return var1;
   }

   static double b(int var0) {
      double var1 = 1.0D;

      for(int var3 = 2; var3 <= var0; ++var3) {
         var1 *= (double)var3;
      }

      return var1;
   }

   static Object a(double var0, double var2) {
      if (var0 >= 0.0D && var2 >= 0.0D && var0 >= var2) {
         int var4 = (int)var0;
         int var5 = (int)var2;
         return b(var4) / (b(var5) * b(var4 - var5));
      } else {
         return zst.f;
      }
   }
}
